﻿using LxBasic;

namespace LxCore
{
    public class PossionEquation : EquationWithDiffTerm
    {
        public override void FormABOnFaces(ThreadInfo threadInfo)
        {
            {
                (int i1, int endp1) = Zone.Inner.FaceIdx.Split(threadInfo);
                var gf = Gamma.GetFaceVarArr(Zone.Inner);
                for (; i1 < endp1; i1++)
                {
                    ref FvInnFace face = ref InnFaces[i1];
                    double gamma = gf.GetFaceVar(i1);
                    AInnO[i1] = -gamma * face.gDiff;
                    InnFaceShare[i1] = gamma * face.CalNonOrthogonalityCorrectionOfInner(Grad, InnX);
                }
            }
            for (int i1 = 0; i1 < EquationBounds.Length; i1++)
            {
                switch (EquationBounds[i1])
                {
                    case FluxWallBound fluxbou:
                        formABOnFluxWallBound(Zone.Bounds[i1], fluxbou, threadInfo);
                        break;
                    case FixValueWallBound fix:
                        formABOnFixValueWallBound(Zone.Bounds[i1], fix, threadInfo);
                        break;
                }
            }
        }
  
        public override bool IsSymmetric()
        {
            return true;
        }
    }
}
